package com.xk._04regEx;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @description: 演示转义字符的使用
 * @author: xu
 * @date: 2022/11/1 13:45
 */
public class RegExp_02 {
    /*
    * Java中需要用到转义符号的字符如下：. * + ( ) $ / \ ? [ ] ^ { }
    * */
    public static void main(String[] args) {
        String content = "abc$(a.bc(123(";
        // 匹配( ==> \\(
        // 匹配. ==> \\.
        String regStr = "\\d{3}"; // == "\\d\\d\\d"
        Pattern pattern = Pattern.compile(regStr);
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()){
            System.out.println("找到：" + matcher.group(0));
        }
    }
}
